package com.distributer.order.model;

import java.io.Serializable;
import java.math.BigDecimal;

import com.alibaba.fastjson.JSONObject;

public class OrderItem implements Serializable {
	
    private static final long serialVersionUID = 1L;

    /**
    * order_item_id
    */
    private Integer orderItemId;

    /**
    * 订单编号
    */
    private String orderNo;

    /**
    * 钧保详情编号
    */
    private String orderItemNo;

    /**
    * 产品名称
    */
    private String productName;

    /**
    * 产品编码
    */
    private String productCode;

    /**
    * 计划名称
    */
    private String planName;

    /**
    * 计划编码
    */
    private String plancode;

    /**
    * 份数
    */
    private Integer copies;

    /**
    * product_price
    */
    private String productPrice;

    /**
    * 总价
    */
    private String totalAmount;

    /**
    * 保单号
    */
    private String policyNo;

    /**
    * 钧保保单号
    */
    private String jbPolicyNo;
    
    private String insuredIdNumber;

    public OrderItem() {
    }

	public OrderItem(String orderNo,String orderItemNo) {
		super();
		this.orderNo = orderNo;
		this.orderItemNo = orderItemNo;
	}

	public OrderItem buildProductinfo(JSONObject productinfoJson) {
		this.productCode = productinfoJson.getString("productCode");
		this.productName = productinfoJson.getString("productName");
		this.plancode = productinfoJson.getString("planCode");
		this.planName = productinfoJson.getString("planName");
		this.copies = productinfoJson.getInteger("copies");
		this.productPrice = productinfoJson.getString("productPrice");
		this.totalAmount = new BigDecimal(copies).multiply(new BigDecimal(productPrice)).toString();
		return this;
	}

	public OrderItem buildPolicyInfo(JSONObject insuranceInfo){
		this.jbPolicyNo = insuranceInfo.getString("jbPolicyNo");
		this.insuredIdNumber = insuranceInfo.getString("insuredIdNumber");
		return this;
	}
	
	public Integer getOrderItemId() {
		return orderItemId;
	}

	public void setOrderItemId(Integer orderItemId) {
		this.orderItemId = orderItemId;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getOrderItemNo() {
		return orderItemNo;
	}

	public void setOrderItemNo(String orderItemNo) {
		this.orderItemNo = orderItemNo;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getProductCode() {
		return productCode;
	}

	public void setProductCode(String productCode) {
		this.productCode = productCode;
	}

	public String getPlanName() {
		return planName;
	}

	public void setPlanName(String planName) {
		this.planName = planName;
	}

	public String getPlancode() {
		return plancode;
	}

	public void setPlancode(String plancode) {
		this.plancode = plancode;
	}

	public Integer getCopies() {
		return copies;
	}

	public void setCopies(Integer copies) {
		this.copies = copies;
	}

	public String getProductPrice() {
		return productPrice;
	}

	public void setProductPrice(String productPrice) {
		this.productPrice = productPrice;
	}

	public String getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(String totalAmount) {
		this.totalAmount = totalAmount;
	}

	public String getPolicyNo() {
		return policyNo;
	}

	public void setPolicyNo(String policyNo) {
		this.policyNo = policyNo;
	}

	public String getJbPolicyNo() {
		return jbPolicyNo;
	}

	public void setJbPolicyNo(String jbPolicyNo) {
		this.jbPolicyNo = jbPolicyNo;
	}

	public String getInsuredIdNumber() {
		return insuredIdNumber;
	}

	public void setInsuredIdNumber(String insuredIdNumber) {
		this.insuredIdNumber = insuredIdNumber;
	}

}
